<?php
include("../../inc/global.inc");
include("../islogin.php");
?>
<?php
session_start();
if($_POST['admin_psw']){
$psw=substr(md5($_POST['admin_psw']),6,18);
mysql_query("update admin set admin_psw='$psw' where admin_cname='".$_SESSION['admin_user']."'");
echo "<script>alert('密码成功修改');location='psw.php';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">修改密码&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<?php
if($_SESSION['admin_user']){
?>
  <table width="50%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <form method="post" action="psw.php" onSubmit="return check()">
    <tr>
      <td height="30" colspan="2" align="center" bgcolor="#8DA8CF"><SPAN id="result_box"><SPAN title="添加管理员信息" closure_hashCode_zhw1zh="37">修改密码</SPAN></SPAN></td>
    </tr>
    <tr>
      <td width="28%" height="30" align="center" bgcolor="#FFFFFF">新密码</td>
      <td width="72%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="admin_psw" type="password" size="18">
        <font color="red">*</font>6-15 字符</td>
    </tr>
    <tr>
      <td height="30" align="center" bgcolor="#FFFFFF"><SPAN id="result_box"><SPAN title="确认新密码" closure_hashCode_zhw1zh="35">确认新密码</SPAN></SPAN></td>
      <td align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="admin_psw2" type="password" size="18">
      <font color="red">*</font>6-15 字符</td>
    </tr>
    <tr>
      <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" value="提交"></td>
    </tr>
	</form>
  </table>
<?php
}?>
</center>
</BODY>
</HTML>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function check(){
if($("admin_psw").value.length<6||$("admin_psw").value.length>15){
alert("请输入6-15为新密码");
$("admin_psw").focus();
return false;
}
if($("admin_psw").value!=$("admin_psw2").value){
alert("您两次输入的密码不一致");
$("admin_psw2").focus();
return false;
}
}
</script>